package com.example.test20log.config;

import com.alibaba.nacos.api.NacosFactory;
import com.alibaba.nacos.api.config.ConfigService;
import com.alibaba.nacos.api.exception.NacosException;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

import java.util.Properties;

/**
 * @Author: fxy
 * @Date: 2022/09/15/14:12
 * @Description:
 */
@Configuration
public class NacosConfig {
    @Bean
    @Primary
    public ConfigService configService() {
        Properties properties = new Properties();
        properties.put("serverAddr", "http://10.10.15.132:8085");
        properties.put("namespace", "test");
        try {
            return NacosFactory.createConfigService(properties);
        } catch (NacosException e) {

        }

        return null;
    }
}
